package com.example.mcpservice;

import com.example.mcpservice.tools.OpenMeteoService;
import com.example.mcpservice.tools.ShopService;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.reactive.function.client.WebClient;

@SpringBootApplication
public class McpServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(McpServiceApplication.class, args);
        System.out.println(" ================== mcp service ==================");
    }

    /**
     * 注入tool中, 用于调用工具方法
     */
    @Bean
    public WebClient.Builder webClientBuilder(){
        return WebClient.builder();
    }


    @Bean
    public ToolCallbackProvider weatherTools(OpenMeteoService openMeteoService , ShopService shopService){
        return MethodToolCallbackProvider.builder()
                .toolObjects(openMeteoService,shopService)
                .build();
    }


}
